﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DocumentEdit.ascx.cs" Inherits="Document_DocumentEdit" %>
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<%@ Register src="../Controls/UploadFile/UploadFile.ascx" tagname="UploadFile" tagprefix="uc1" %>
    <asp:Panel ID="pnlProject" CssClass="centerPanel" runat="server">
    <div class="webPanelBorder">
        <div class="webPanelCaption"><asp:Literal ID="literalCaption" runat="server"></asp:Literal></div>
        <div class="webPanelContent">
        <table cellspacing="1" class="table">
            <tr>
                <td class="tableSubjectWidth">主标题：</td>
                <td>
                    <asp:TextBox ID="tbSubject" runat="server" CssClass="shortInput" Width="650" ></asp:TextBox><span class="requiredField">*</span>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
                    
                </td>
            </tr>
            <tr>  
                <td class="tableSubjectWidth">副标题：</td>
                <td><asp:TextBox ID="tbSubTitle" runat="server" CssClass="shortInput" Width="650"></asp:TextBox>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
            </tr>    
            <tr>  
                <td class="tableSubjectWidth">标题样式：</td>
                <td>
                    <ofcc:DropDownList ID="ddlSubjectFont" runat="server" Width="80px">
                        <asp:ListItem value="">字体</asp:ListItem>
                    </ofcc:DropDownList>&nbsp;
                    <ofcc:DropDownList ID="ddlSubjectSize" runat="server" Width="80px">
                        <asp:ListItem value="">字号</asp:ListItem>
                    </ofcc:DropDownList>&nbsp;
                    <ofcc:DropDownList ID="ddlSubjectColor" runat="server" Width="80px">
                        <asp:ListItem value="">颜色</asp:ListItem>
                        <asp:ListItem style="color: #ffffff; background-color: black" value="#000000">Black</asp:ListItem>
                        <asp:ListItem style="background-color: gray" value="#808080">Gray</asp:ListItem>
                        <asp:ListItem style="background-color: darkgray" value="#A9A9A9">DarkGray</asp:ListItem>
                        <asp:ListItem style="background-color: lightgrey" value="#D3D3D3">LightGray</asp:ListItem>
                        <asp:ListItem style="background-color: white" value="#FFFFFF">White</asp:ListItem>
                        <asp:ListItem style="background-color: aquamarine" value="#7FFFD4">Aquamarine</asp:ListItem>
                        <asp:ListItem style="background-color: blue" value="#0000FF">Blue</asp:ListItem>
                        <asp:ListItem style="color: #ffffff; background-color: navy" value="#000080">Navy</asp:ListItem>
                        <asp:ListItem style="color: #ffffff; background-color: purple" value="#800080">Purple</asp:ListItem>
                        <asp:ListItem style="background-color: deeppink" value="#FF1493">DeepPink</asp:ListItem>
                        <asp:ListItem style="background-color: violet" value="#EE82EE">Violet</asp:ListItem>
                        <asp:ListItem style="background-color: pink" value="#FFC0CB">Pink</asp:ListItem>
                        <asp:ListItem style="color: #ffffff; background-color: darkgreen" value="#006400">DarkGreen</asp:ListItem>
                        <asp:ListItem style="color: #ffffff; background-color: green" value="#008000">Green</asp:ListItem>
                        <asp:ListItem style="background-color: yellowgreen" value="#9ACD32">YellowGreen</asp:ListItem>
                        <asp:ListItem style="background-color: yellow" value="#FFFF00">Yellow</asp:ListItem>
                        <asp:ListItem style="background-color: orange" value="#FFA500">Orange</asp:ListItem>
                        <asp:ListItem style="background-color: red" value="#FF0000">Red</asp:ListItem>
                        <asp:ListItem style="background-color: brown" value="#A52A2A">Brown</asp:ListItem>
                        <asp:ListItem style="background-color: burlywood" value="#DEB887">BurlyWood</asp:ListItem>
                        <asp:ListItem style="background-color: beige" value="#F5F5DC">Beige</asp:ListItem>
                    </ofcc:DropDownList>&nbsp;&nbsp;                  
                    <asp:CheckBox ID="cbSubjectBlod" Text="标题粗体" runat="server" />&nbsp;&nbsp;
                     <asp:CheckBox ID="cbOnTop" Text="文档置顶" runat="server" />&nbsp;&nbsp;
                    <asp:CheckBox ID="cbRecommended" Text="推荐文档"  runat="server" />&nbsp;&nbsp;
                    <asp:CheckBox ID="cbAllowFeedback" Text="允许评论"  runat="server" /> 
                </td>
            </tr>    
            <tr>
                <td>缩略图片(129*97px)<%--(310*210px)--%>：</td>
                <td>
                    <asp:TextBox ID="tbHotImageFileName" runat="server" CssClass="shortInput" Width="265"></asp:TextBox>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    描述：<asp:TextBox ID="tbHotImageTip" runat="server" MaxLength="50" CssClass="shortInput" Width="230"></asp:TextBox>
                </td>
            </tr>        
            
            <tr>
                <td>类别：</td>
                <td>
                    <ofcc:DropDownList ID="ddlCategory" runat="server" Width="145px"></ofcc:DropDownList>
                    &nbsp;&nbsp;来源：<asp:TextBox ID="tbSource" runat="server" CssClass="shortInput" Width="75"></asp:TextBox>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    作者：<asp:TextBox ID="tbAuthor" runat="server" CssClass="shortInput" Width="230"></asp:TextBox>
                    </td>
            </tr>
            
            <tr>
                <td>内容：</td>
                <td>
                <FTB:FreeTextBox id="freeTextBox" runat="Server" 
                    ToolbarImagesLocation="ExternalFile"
                    JavaScriptLocation ="ExternalFile"
                    SupportFolder="~/Controls/FreeTextBox/"
                    DesignModeCss="designmode.css"
                    Language="zh-cn"
                    Width="800px"
                    OnSaveClick="btnSave_Click"              
                    toolbarlayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker;JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;Bold,Italic,Underline,Strikethrough;Undo,Redo;InsertDate,InsertTime,InsertTable,InsertImageFromGallery" 
		            />
		            <%--Cut,Copy,Paste,;SelectAll,Preview--%>
                </td>
            </tr>
        </table>
        </div>
    </div>
    <div class="webPanelButtonArea">
        <span class="linkButtonOut"><asp:LinkButton ID="btnSave" runat="server"  CssClass="linkButton" 
            OnClick="btnSave_Click" OnClientClick="closePop();" ValidationGroup="record">保存发布</asp:LinkButton></span>
        <span class="linkButtonOut"><asp:LinkButton ID="btnSaveTemp" runat="server"  CssClass="linkButton" 
            OnClick="btnSaveTemp_Click" OnClientClick="closePop();" ValidationGroup="record">保存草稿</asp:LinkButton></span>
        <span class="linkButtonOut"><asp:LinkButton ID="btnUpload" runat="server"  CssClass="linkButton" 
            OnClick="btnSaveTemp_Click" OnClientClick="return false" ValidationGroup="record">批量上传</asp:LinkButton></span>        
        <span class="linkButtonOut"><asp:LinkButton ID="btnClear" runat="server"  CssClass="linkButton" 
            OnClientClick="return clearFTB();" OnClick="btnClear_Click" >清除</asp:LinkButton></span>
    </div>
    </asp:Panel>
    <asp:HiddenField ID="hfID" runat="server" />    
    <asp:HiddenField ID="hfAddOrEdit" runat="server" />
    <uc1:UploadFile ID="UploadFile1" runat="server"  />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbSubject"
        Display="None" ErrorMessage="请输入标题!" ValidationGroup="record"></asp:RequiredFieldValidator><asp:ValidationSummary
            ID="ValidationSummary1" runat="server" EnableViewState="False" ShowMessageBox="True" 
            ShowSummary="False" ValidationGroup="record" />
    <script type="text/javascript">
    //IE
    if(Prototype.Browser.IE)
    {
        document.body.onunload = function(){
            closePop();
        }
    }
    else
    {
        //FF
        window.onunload = function(){
            closePop();
        }
    }


    function closePop()
    {
        if (FTB_API['<%=freeTextBox.ClientID %>'].Gallery() != null &&
        FTB_API['<%=freeTextBox.ClientID %>'].Gallery().closed == false)
        {
            FTB_API['<%=freeTextBox.ClientID %>'].Gallery().close();
        }
    }

    function clearFTB() {
        if (confirm('确定要清除吗?')) {
            FTB_API['<%=freeTextBox.ClientID %>'].htmlEditor.innerText = "";
            FTB_API['<%=freeTextBox.ClientID %>'].designEditor.document.body.innerHTML = "";
        }
        return false;
    }
    </script>
